<html>
<head><meta charset="utf-8"><title>Lifetime issue solved wiht nll · t-compiler/wg-nll · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/index.html">t-compiler/wg-nll</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html">Lifetime issue solved wiht nll</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207204945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/207204945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#207204945">(Aug 17 2020 at 22:36)</a>:</h4>
<p>Hello! I am having trouble trying to make this code <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=b02afb81b44d3de255d82032058045aa">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=b02afb81b44d3de255d82032058045aa</a> compile on stable. They only way i was able to was to enable <code>nll</code> on nightly.<br>
I guess I have two questions:</p>
<ol>
<li>Is there a way I could make it compile on stable? Its really a minimized version of a more complicated code, I know it looks like a contrived example, but that's what I managed to reproduce as a minimalist example.</li>
<li>Is nll getting stabilized any time soon?</li>
</ol>



<a name="207205657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/207205657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#207205657">(Aug 17 2020 at 22:45)</a>:</h4>
<p>The compiler is trying to help with: <code>help: consider adding an explicit lifetime bound `&lt;C as Compiler&lt;'_&gt;&gt;::ExecutionContext: 'a`...</code> but I can't find a syntax to add lifetime bounds on closure parameters</p>



<a name="207205963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/207205963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#207205963">(Aug 17 2020 at 22:49)</a>:</h4>
<p>Surprisingly this version where the lifetime <code>'s</code> has been moved from away <code>Compiler</code> trait itself to its compile method works: <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=02e0784d4150de8aa3af8d8fd4b4aa95">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=02e0784d4150de8aa3af8d8fd4b4aa95</a></p>



<a name="207206000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/207206000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#207206000">(Aug 17 2020 at 22:49)</a>:</h4>
<p>But I really want the lifetime to be on the <code>Compiler</code> trait</p>



<a name="207586526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/207586526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#207586526">(Aug 20 2020 at 23:33)</a>:</h4>
<p>However I look at the problem and whatever I try, I always end up in a situation where the current borrow checker is reporting an error that is fixed by enabling nll :(</p>



<a name="208446689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208446689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208446689">(Aug 29 2020 at 18:12)</a>:</h4>
<p>I thought NLL was stable? I am surprised to hear that <code>feature(nll)</code> still does anything.</p>



<a name="208449419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208449419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208449419">(Aug 29 2020 at 19:17)</a>:</h4>
<p>I think there's parts of 2 part borrows or so that weren't quite stabilized, but I don't remember details</p>



<a name="208459718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208459718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208459718">(Aug 29 2020 at 23:43)</a>:</h4>
<p>Enabling <code>nll</code> also provides substantially better error messages. When I struggle with too-complicated lifetime errors, I enable nll and that usually helps.</p>



<a name="208459780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208459780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208459780">(Aug 29 2020 at 23:45)</a>:</h4>
<p>Is there any progress about stabilizing <code>nll</code> that I can track / follow? Or even help with? I am probably not qualified but who knows :p</p>



<a name="208464132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208464132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208464132">(Aug 30 2020 at 02:09)</a>:</h4>
<p>I think there's parts of 2 part borrows or so that weren't quite stabilized, but I don't remember details</p>



<a name="208471946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208471946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208471946">(Aug 30 2020 at 06:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> or <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> might know</p>



<a name="208477863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208477863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208477863">(Aug 30 2020 at 10:06)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/57895">#57895</a> has the current state</p>



<a name="208479453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208479453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208479453">(Aug 30 2020 at 10:55)</a>:</h4>
<p>About <a href="https://github.com/rust-lang/rust/issues/59159">https://github.com/rust-lang/rust/issues/59159</a>, the warn lint was added a year and half ago, can we put the lint as deny by default now? I am going to create a PR to start the discussion</p>



<a name="208479805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208479805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208479805">(Aug 30 2020 at 11:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116118">Matthew Jasper</span> <a href="#narrow/stream/122657-t-compiler.2Fwg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll/near/208477863">said</a>:</p>
<blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/57895">#57895</a> has the current state</p>
</blockquote>
<p>hm, so we have stage 3 but not stage 2? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="208479989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208479989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208479989">(Aug 30 2020 at 11:09)</a>:</h4>
<p>Also <a href="https://github.com/rust-lang/rust/issues/57642">https://github.com/rust-lang/rust/issues/57642</a> has been "fixed" is now only about diagnostic, I don't know how to improve it, but it might not be a blocker for full-nll anymore?</p>



<a name="208480713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208480713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208480713">(Aug 30 2020 at 11:29)</a>:</h4>
<p>Just opened <a href="https://github.com/rust-lang/rust/pull/76104">https://github.com/rust-lang/rust/pull/76104</a></p>



<a name="208905428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208905428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208905428">(Sep 03 2020 at 00:11)</a>:</h4>
<p>I believe that <code>feature(nll)</code> still disables some trait errors, like higher-ranked errors, so it might be related to that</p>



<a name="208931972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/Lifetime%20issue%20solved%20wiht%20nll/near/208931972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/Lifetime.20issue.20solved.20wiht.20nll.html#208931972">(Sep 03 2020 at 07:55)</a>:</h4>
<p>Anything I can do to help?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>